package com.qianxun;

import com.qianxun.api.AdditionalParameterGenerator;
import com.qianxun.api.ApiConfiguration;
import com.qianxun.api.ApiLoader;
import com.qianxun.api.list.TestApi;

/**
 * @author: huwei
 * @date: 2020/11/2 15:06
 * @version: 1.0.0
 */
public class Test {

    public static void main(String[] args) {
        //极简
        String s = ApiLoader.load(new ApiConfiguration("http://www.baidu.com", "", ""))
                .build().instanceApi(TestApi.class).baiduTest();
        System.out.println(s);

        //全局辅助参数
        s = ApiLoader.load(new ApiConfiguration("http://www.baidu.com", "", ""), new AdditionalParameterGenerator() {
            @Override
            public AdditionalParameter[] headerParameter(ApiConfiguration apiConfiguration) {
                return new AdditionalParameter[]{new AdditionalParameter("gg" ,"gg")};
            }
        }).build().instanceApi(TestApi.class).baiduTest();
        System.out.println(s);

        //特定请求辅助参数
        s = ApiLoader.load(new ApiConfiguration("http://www.baidu.com", "", "")).build(new AdditionalParameterGenerator() {
            @Override
            public AdditionalParameter[] headerParameter(ApiConfiguration apiConfiguration) {
                return new AdditionalParameter[]{new AdditionalParameter("gg" ,"gg")};
            }
        }).instanceApi(TestApi.class).baiduTest();
        System.out.println(s);
    }
}
